<?php
/**
 * Created by openXtiger.org.
 * User: lunzi
 * Date: 2009-6-27
 * Time: 17:22:49
 * To change this template use File | Settings | File Templates.
 */

/*public */function companymodel_findCompanyByUserId($uid) {
    $db = xt_load('db');
    return $db->fetch_first("SELECT * FROM `icweb_company` WHERE uid= '$uid'");
}

/*public */function companymodel_findCompanyDetailByUserId($uid) {
    $db = xt_load('db');
    return $db->fetch_first("SELECT * FROM `icweb_company_detail` WHERE uid= '$uid'");
}

/*public */function companymodel_updateCompanyByUserId($uid,$comany_name,$comany_type,$sales_style,$comany_address,$production,$comany_intro,$site_url,$jobs,$dept) {
    $db = xt_load('db');
    $sql = "update `icweb_company` ";
    $sql .="set comany_name='$comany_name', ";
    $sql .="comany_type='$comany_type', ";
    $sql .="sales_style='$sales_style', ";
    $sql .="comany_address='$comany_address', ";
    $sql .="sale_product='$production', ";
    $sql .="comany_intro='$comany_intro', ";
    $sql .="site_url='$site_url', ";
    $sql .="jobs='$jobs', ";
    $sql .="dept='$dept', ";
    $sql .="is_create='y' ";
    $sql .="WHERE uid= $uid ";
    //echo $sql;
    return $db->fetch_first($sql);
}

/*public */function companymodel_updateCompanyDetailByUserId($uid,$params_arr) {
    $db = xt_load('db');
    $sql = "update `icweb_company_detail` ";
    $sql .="set create_time='$params_arr[0]', ";
    $sql .="reg_place='$params_arr[1]', ";
    $sql .="principal='$params_arr[2]', ";
    $sql .="bank='$params_arr[3]', ";
    $sql .="account='$params_arr[4]', ";
    $sql .="plant_area='$params_arr[5]', ";
    $sql .="headcount='$params_arr[6]', ";
    $sql .="tech_persons_no='$params_arr[7]', ";
    $sql .="brand_name='$params_arr[8]', ";
    $sql .="month_output='$params_arr[9]', ";
    $sql .="annual_turnover='$params_arr[10]', ";
    $sql .="import_value='$params_arr[11]', ";
    $sql .="export_value='$params_arr[12]', ";
    $sql .="management_cert='$params_arr[13]', ";
    $sql .="other_cert='$params_arr[14]', ";
    $sql .="quality_control='$params_arr[15]', ";
    $sql .="leading_market='$params_arr[16]', ";
    $sql .="other_market='$params_arr[17]', ";
    $sql .="main_clients='$params_arr[18]', ";
    $sql .="is_oem='$params_arr[19]', ";
    $sql .="month_output_unit='$params_arr[20]' ";
    $sql .="WHERE uid= $uid ";
    //echo $sql;
    return $db->fetch_first($sql);
}

?>